
TRIGGER PROCEDURE FOR DELETE OF RQD_DET.

{mfdeclre.i }
define new shared work-table wf_old_rqd_det like rqd_det.

HK:
do:
    if can-find(first dt_mstr where dt_table = "rqd_det" and dt_type = "SYNC") then
        run CreateSyncFlag(input "DEL", input recid(rqd_det), input "rqd_det").

    if not can-find ( first dt_mstr where dt_table = "rqd_det" and dt_type = "DEL" ) then leave HK.
    
    if not can-find ( first wf_old_rqd_det ) then do:
        create wf_old_rqd_det.
        if recid(wf_old_rqd_det)= -1 then .
    end.
    
    buffer-copy rqd_det to wf_old_rqd_det no-error.

    for first dt_mstr no-lock where dt_table = "rqd_det" and dt_type = "DEL" :
    
        run CreateDthist(input dt_table, input dt_field, input dt_type, input "", input "", 
            input recid(rqd_det), input rqd_det.rqd_nbr, input string(rqd_det.rqd_line), input "", input "",
            input "", input "", input "", input "") .
    
    end.
end.

{hkdttrans.i}
